import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common';
import { SubCategoryService } from './sub-category.service';
import { CreateSubCategoryDto, DeleteSubCategoryDto, EditSubCategoryDto, FindSubAllDto } from './dto/sub-category.dto';

@Controller('sub-category')
export class SubCategoryController {
  constructor(private readonly subCategoryService: SubCategoryService) { }

  // 创建子类别
  @Post('create')
  create(@Body() cscd: CreateSubCategoryDto) {
    return this.subCategoryService.create(cscd);
  }

  // 查找所有子类别
  @Post('findSubAll')
  findAll(@Body() fsad: FindSubAllDto) {
    return this.subCategoryService.findSubAll(fsad);
  }

  @Post('edit')
  edit(@Body() escd: EditSubCategoryDto) {
    return this.subCategoryService.edit(escd);
  }

  @Post('delete')
  delete(@Body() dscd: DeleteSubCategoryDto) {
    return this.subCategoryService.delete(dscd);
  }
}
